home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / pcl4p33.zip / PCL4P.REF < prev    next >
Text File  |  1992-08-01  |  51KB  |  2,101 lines

  1.  
  2.  
  3.                           Personal Communications Library
  4.  
  5.                                 For the Turbo Pascal
  6.  
  7.  
  8.                                     ( PCL4P )
  9.  
  10.  
  11.  
  12.                                REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                   Version 3.3
  19.  
  20.                                   Aug 3, 1992
  21.  
  22.  
  23.  
  24.  
  25.                         This software is provided as-is.
  26.                  There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                               Copyright (C) 1992
  32.                               All rights reserved
  33.  
  34.  
  35.  
  36.                               MarshallSoft Computing, Inc.
  37.                               Post Office Box 4543
  38.                               Huntsville AL 35815
  39.  
  40.                               Voice 205-881-4630
  41.                               FAX   205-881-4630
  42.                               BBS   205-880-9748
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         PCL4P Reference Manual                                 Page 1
  61.                                 C O N T E N T S
  62.  
  63.  
  64.  
  65.  
  66.  
  67.               Chapter                                                 Page
  68.  
  69.               Table of Contents......................................2
  70.               Introduction...........................................3
  71.                  SioBaud.............................................4
  72.                  SioBrkKey...........................................5
  73.                  SioBrkSig...........................................6
  74.                  SioCTS..............................................7
  75.                  SioDCD..............................................8
  76.                  SioDelay............................................9
  77.                  SioDone............................................10
  78.                  SioDSR.............................................11
  79.                  SioDTR.............................................12
  80.                  SioError...........................................13
  81.                  SioFIFO............................................14
  82.                  SioFlow............................................15
  83.                  SioGetc............................................16
  84.                  SioInfo............................................17
  85.                  SioIRQ.............................................18
  86.                  SioLine............................................19
  87.                  SioLoopBack........................................20
  88.                  SioModem...........................................21
  89.                  SioParms...........................................22
  90.                  SioPutc............................................23
  91.                  SioRead............................................24
  92.                  SioReset...........................................25
  93.                  SioRI..............................................26
  94.                  SioRTS.............................................27
  95.                  SioRxBuf...........................................28
  96.                  SioRxFlush.........................................29
  97.                  SioRxQue...........................................30
  98.                  SioTimer...........................................31
  99.                  SioUART............................................32
  100.                  SioUnGetc..........................................33
  101.               Function Summary......................................34
  102.               Error Code Summary....................................35
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.         PCL4P Reference Manual                                 Page 2
  121.                              Introduction
  122.  
  123.  
  124.          This  manual  list  all the PCL4P functions in alphabetical order.
  125.          Every library function will return a value as follows:
  126.  
  127.          1.  Negative values for error conditions. See last  page  of  this
  128.          manual for a list of error values and their meanings.
  129.  
  130.          2.  Non-negative values when returning data ( eg: SioLine ).
  131.  
  132.          3.  Zero otherwise.
  133.  
  134.          When  debugging an application, be sure to test all return values.
  135.          Use SioError to print the associated text for errors.
  136.  
  137.  
  138.          Example Code Segment
  139.  
  140.          **********************************************************
  141.          *  RetCode := SioFunction();    (* any PCL4P function *) *
  142.          *  if RetCode < 0 then begin                             *
  143.          *    RetCode := SioError(RetCode);                       *
  144.          *    (* ...do some stuff... *)                           *
  145.          *    end;                                                *
  146.          **********************************************************
  147.  
  148.          For more examples, examine each of the example programs  provided.
  149.          Also  look  at  the examples associated with each library function
  150.          described in the following section.
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.         PCL4P Reference Manual                                 Page 3
  181.                                   SioBaud
  182.  
  183.  
  184.          Function    Sets the baud rate of the selected port.
  185.  
  186.            Syntax    function SioBaud(Port,BaudCode:Integer) : Integer;
  187.  
  188.           Remarks    The  SioBaud  function  sets  the  baud  rate  without
  189.                      resetting the port. It is used to change the baud rate
  190.                      after calling SioReset.
  191.  
  192.                      Baud Code           Baud Rate       PCL4P.H Name
  193.                           0                 300            Baud300
  194.                           1                 600            Baud600
  195.                           2                1200            Baud1200
  196.                           3                2400            Baud2400
  197.                           4                4800            Baud4800
  198.                           5                9600            Baud9600
  199.                           6               19200            Baud19200
  200.                           7               38400            Baud38400
  201.                           8               57600            Baud57600
  202.                           9              115200            Baud115200
  203.  
  204.  
  205.           Returns     -4 : Port out of range. Expecting   0  to 3.
  206.                      -11 : Bad baud rate code. See above code values.
  207.  
  208.           Example
  209.  
  210.                       /* do auto baud detect */
  211.                       for Code = 0 to 9 do begin
  212.                       RetCode := SioBaud(Port,Code);
  213.                       RetCode := SioPutc(Port,'A');
  214.                       if SioGetc(Port,18) = Ord('A') then
  215.                         begin
  216.                           writeln('Baud rate detected');
  217.                           (*...do something here...*)
  218.                         end
  219.                       end;
  220.  
  221.          See Also    SioReset
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.         PCL4P Reference Manual                                 Page 4
  241.                                   SioBrkKey
  242.  
  243.  
  244.          Function    Return non-zero if the Control-BREAK key was pressed.
  245.  
  246.            Syntax    function SioBrkKey : Integer;
  247.  
  248.           Remarks    The SioBrkKey function returns a TRUE value ( non zero
  249.                      ) if  the  Control-BREAK  key  was  pressed,  else  it
  250.                      returns a zero.  Use SioBrkKey as a safety exit from a
  251.                      polling   loop.   Don't  mix  this  function  up  with
  252.                      SioBrkSig.
  253.  
  254.           Returns    -1 : Control-BREAK was pressed.
  255.                       0 : Control-BREAK was NOT pressed.
  256.  
  257.           Example
  258.  
  259.                      if SioBrkKey then
  260.                        begin
  261.                          writeln('User typed Contrl-BREAK');
  262.                          RetCode := SioDone(Port);
  263.                          halt;
  264.                        end;
  265.  
  266.          See Also    SioBrkSig
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.         PCL4P Reference Manual                                 Page 5
  301.                                   SioBrkSig
  302.  
  303.  
  304.  
  305.          Function    Asserts, cancels, or detects BREAK signal.
  306.  
  307.            Syntax    function SioBrkSig(Port:Integer;Cmd:Char) : Boolean;
  308.  
  309.           Remarks    The SioBrkSig function controls the BREAK  bit
  310.                      in the line status register. The legal commands are:
  311.  
  312.                      ASSERT ('A') to assert BREAK
  313.                      CANCEL ('C') to cancel BREAK
  314.                      DETECT ('D') to detect BREAK
  315.  
  316.                      ASSERT,  CANCEL,  and  DETECT  are defined in PCL4P.H.
  317.                      See TERM.C for an example of the use of SioBrkSig.
  318.  
  319.           Returns    -2 : Port not enabled. Call SioReset first.
  320.                      -4 : Port out of range. Expecting  0 to 3.
  321.                      -6 : Illegal command. Expected 'A', 'C', or 'D'.
  322.                      >0 : BREAK signal detected ( DETECT command only )
  323.  
  324.           Example
  325.  
  326.                      (* Assert BREAK for 1 second *)
  327.                      RetCode := SioBrkSig(Port,ASSERT);
  328.                      RetCode := SioDelay(18);
  329.                      RetCode := SioBrkSig(Port,CANCEL);
  330.                      (* Detect BREAK *)
  331.                      if SioBrkSig(Port,DETECT) then
  332.                        begin
  333.                          writeln('BREAK signal detected');
  334.                            (* ...do some more stuff... *)
  335.                        end
  336.  
  337.          See Also    SioBrkKey
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.         PCL4P Reference Manual                                 Page 6
  361.                                   SioCTS
  362.  
  363.  
  364.  
  365.          Function    Reads the Clear to Send ( CTS ) modem status bit.
  366.  
  367.            Syntax    function SioCTS(Port:Integer) : Integer;
  368.  
  369.           Remarks    The  SioCTS function is used to read the Clear to Send (
  370.                      CTS ) modem status bit.
  371.  
  372.           Returns    -2 : Port not enabled. Call SioReset first.
  373.                      -4 : Port out of range.  Expecting  0 to 3.
  374.                       0 : CTS is clear.
  375.                      >0 : CTS is set.
  376.  
  377.           Example
  378.  
  379.                      RetCode := SioCTS(Port);
  380.                      if RetCode > 0 then write('CTS is set');
  381.                      else write('CTS is clear');
  382.  
  383.          See Also    SioDSR, SioRI, SioDCD, and SioModem.
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.         PCL4P Reference Manual                                 Page 7
  421.                                   SioDCD
  422.  
  423.  
  424.  
  425.          Function    Reads  the  Data  Carrier Detect ( DCD ) modem status
  426.                      bit.
  427.  
  428.            Syntax    function SioDCD(Port:Integer) : Integer;
  429.  
  430.           Remarks    The SioDCD function is used to read the  Data  Carrier
  431.                      Detect ( DCD ) modem status bit. Also see SioModem.
  432.  
  433.           Returns    -2 : Port not enabled. Call SioReset first.
  434.                      -4 : Port out of range.  Expecting  0 to 3.
  435.                       0 : DCD is clear.
  436.                      >0 : DCD is set.
  437.  
  438.           Example
  439.  
  440.                      RetCode := SioDCD(Port);
  441.                      if RetCode > 0 then write('DCD is set');
  442.                      else write('DCD is clear');
  443.  
  444.          See Also    SioDSR, SioCTS, SioRI, and SioModem.
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.         PCL4P Reference Manual                                 Page 8
  481.                                   SioDelay
  482.  
  483.  
  484.  
  485.          Function    Delays one or more tics.
  486.  
  487.            Syntax    function SioDelay(Tics:Integer) : Integer;
  488.  
  489.           Remarks    The  SioDelay  function  is used to delay one  or more
  490.                      timer tics, where each timer tic is  approximately  55
  491.                      milliseconds ( 18 to the second ).
  492.  
  493.           Returns    zero
  494.  
  495.           Example    (* delay 5 seconds *)
  496.                      RetCode := SioDelay(5*18);
  497.  
  498.          See Also    SioTimer
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.         PCL4P Reference Manual                                 Page 9
  541.                                   SioDone
  542.  
  543.  
  544.  
  545.          Function    Terminates further serial processing.
  546.  
  547.            Syntax    function SioDone(Port:Integer) : Integer
  548.  
  549.           Remarks    The  SioDone  function  terminates  further  serial
  550.                      processing. SioDone MUST be called before exiting your
  551.                      application so that  interrupts  can  be  restored  to
  552.                      their original state. Failure to do this can crash the
  553.                      operating  system.   If  you  forget  to  call SioDone
  554.                      before exiting, be sure to re-boot your computer.  You
  555.                      can call SioDone even if SioReset has not been called,
  556.                      so it is good practice to always call  SioDone  before
  557.                      exiting your application.
  558.  
  559.           Returns    -2 : Port not enabled. Call SioReset first.
  560.                      -4 : Port out of range. Expecting  0 to 3.
  561.  
  562.           Example    (* terminate processing for COM3 *)
  563.                      RetCode := SioDone(COM3);
  564.  
  565.          See Also    SioReset.
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.         PCL4P Reference Manual                                 Page 10
  601.                                   SioDSR
  602.  
  603.  
  604.  
  605.          Function    Reads the Data Set Ready ( DSR ) modem status bit.
  606.  
  607.            Syntax    function SioDSR(Port:Integer) : Integer;
  608.  
  609.           Remarks    The SioDSR function is used  to  read  the  Data  Set
  610.                      Ready ( DSR ) modem status bit.
  611.  
  612.           Returns    -2 : Port not enabled. Call SioReset first.
  613.                      -4 : Port out of range.  Expecting  0 to 3.
  614.                       0 : DSR is clear.
  615.                      >0 : DSR is set
  616.  
  617.           Example
  618.  
  619.                      RetCode := SioDSR(Port);
  620.                      if RetCode > 0 then write('DSR is set');
  621.                      else write('DSR is clear');
  622.  
  623.          See Also    SioCTS, SioRI, SioDCD, and SioModem
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.         PCL4P Reference Manual                                 Page 11
  661.                                   SioDTR
  662.  
  663.  
  664.  
  665.          Function    Set, clear, or read the Data Terminal Ready  (  DTR  )
  666.                      bit.
  667.  
  668.            Syntax    function SioDTR(Port,Cmd:Integer) : Integer;
  669.  
  670.           Remarks    The SioDTR function controls the Data Terminal Ready (
  671.                      DTR  )  bit in the modem control register.  Commands (
  672.                      defined in PCL4P.H ) are:
  673.  
  674.                      SetPort  ('S')  to set DTR ( ON )
  675.                      ClrPort  ('C')  to clear DTR ( OFF )
  676.                      ReadPort ('R')  to read DTR
  677.  
  678.           Returns    -2 : Port not enabled. Call SioReset first.
  679.                      -4 : Port out of range. Expecting  0 to 3.
  680.                      -5 : Not one of 'S', 'C', or 'R'.
  681.                       0 : DTR is OFF (READ Command).
  682.                      >0 : DTR is ON (READ Command).
  683.  
  684.           Example
  685.  
  686.                      (* turn DTR on for modem connected to COM4 *)
  687.                      RetCode := SioDTR(COM4,SetPort);
  688.  
  689.          See Also    SioRTS.
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         PCL4P Reference Manual                                 Page 12
  721.                                   SioError
  722.  
  723.  
  724.          Function    Displays error in text.
  725.  
  726.            Syntax    function SioError(Code:Integer) : Integer;
  727.  
  728.           Remarks    The SioError  function  displays  the  error  in  text
  729.                      corresponding  to  the error code.  During development
  730.                      of a communications application, it is a good idea  to
  731.                      always   test   return  codes,  and  print  out  their
  732.                      descriptions with SioError.
  733.  
  734.           Returns    zero
  735.  
  736.           Example
  737.  
  738.                      RetCode := SioReset(Port,Baud4800);
  739.                      if RetCode < 0 then RetCode := SioError(RetCode);
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.         PCL4P Reference Manual                                 Page 13
  781.                                   SioFIFO
  782.  
  783.  
  784.  
  785.          Function    Sets the FIFO trigger level ( INS16550 only ).
  786.  
  787.            Syntax    Function SioFIFO(Port,LevelCode:Integer) : Integer
  788.  
  789.           Remarks    The SioFIFO function is used to set the trigger level
  790.                      at which interrupts are generated. For example, if the
  791.                      FIFO level is set to 8, then the  INS16550  UART  will
  792.                      not  generate  an  interrupt  until  8 bytes have been
  793.                      received.   This  reduces  the  number  of  interrupts
  794.                      generated  and  allows  faster  processing with slower
  795.                      machines or when running simultaneous  ports.
  796.  
  797.                      In  order  to  test  if  your port is a INS16550, call
  798.                      SioFIFO with a LevelCode of other than FIFO_OFF.
  799.  
  800.                      SioFIFO  can  be  called  for  the INS8250 without ill
  801.                      effect.
  802.  
  803.  
  804.                      Code  PCL4C.H Name  Trigger Level
  805.                      -1      FIFO_OFF     Disable FIFO
  806.                       0      LEVEL_1      1 byte
  807.                       1      LEVEL_4      4 bytes
  808.                       2      LEVEL_8      8 bytes
  809.                       3      LEVEL_14     14 bytes
  810.  
  811.  
  812.           Returns    -2 : Port not enabled. Call SioReset first.
  813.                      -4 : Port out of range.  Expecting  0 to 3.
  814.                      >0 : FIFO level set.
  815.                       0 : FIFO level not set ( not INS16550 ).
  816.  
  817.           Example    (* Set FIFO level to 8 *)
  818.                      if SioFIFO(Port,LEVEL_8) then writeln('FIFO reset')
  819.                      else writeln('UART in not INS16550');
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.         PCL4P Reference Manual                                 Page 14
  841.                                   SioFlow
  842.  
  843.  
  844.  
  845.          Function    Sets hardware (RTS/CTS) flow contol.
  846.  
  847.            Syntax    Function SioFIFO(Port,Tics:Integer) : Integer
  848.  
  849.           Remarks    The  SioFlow  function  is  used  to enable or disable
  850.                      hardware fow control. Hardware flow control  uses  RTS
  851.                      and CTS to control data flow between the modem and the
  852.                      computer.  Refer to the User's Manual for a discussion
  853.                      of flow control. To enable hardware flow control, call
  854.                      SioFlow with Tics > 0.
  855.  
  856.                      "Tics" is the number of timer  tics  (18  per  second)
  857.                      before a call to SioPutc will time out because because
  858.                      the modem dropped CTS.
  859.  
  860.                      In order for hardware flow control to work  correctly,
  861.                      your  modem  must  also  be  configured  to  work with
  862.                      hardware flow control,  and  your  computer  to  modem
  863.                      cable must have RTS and CTS wired staright through. if
  864.                      you  enable  hardware  flow control, do not modify the
  865.                      RTS line (by calling SioRTS) unless you  know  exactly
  866.                      what you are doing.
  867.  
  868.                      Flow  control  is  disabled after resetting a port. To
  869.                      explicitly disable hardware flow contol, call  SioFlow
  870.                      with Tics = -1.
  871.  
  872.           Returns    -2 : Port not enabled. Call SioReset first.
  873.                      -4 : Port out of range.  Expecting  0 to 3.
  874.                      =0 : Flow control disabled.
  875.                      >0 : Flow control enabled.
  876.  
  877.           Example    (* Enable flow control on COM1 *)
  878.                      Code := SioFlow(COM1,18);
  879.                      if Code > 0 then WriteLn('Flow control enabled')
  880.                      else Code := SioError(Code);
  881.  
  882.                      (* Disable flow control on COM2 *)
  883.                      Code := SioFlow(COM2,-1);
  884.                      if Code = 0 then WriteLn('Flow control disabled')
  885.                      else Code := SioError(Code);
  886.  
  887.          Also See    SioPutc
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.         PCL4P Reference Manual                                 Page 15
  901.                                SioGetc
  902.                                   SioGetc
  903.  
  904.  
  905.          Function    Reads the next character from the serial line.
  906.  
  907.            Syntax    function SioGetc(Port,Tics:Integer) : Integer;
  908.  
  909.           Remarks    The  SioGetc function reads the selected serial port.
  910.                      The function will wait for the number of  system  tics
  911.                      given  by  the 'Tics' argument before returning 'timed
  912.                      out'. There are 18 tics to the second.
  913.  
  914.                      To specify no waiting, call SioGetc with Tics = 0.
  915.  
  916.           Returns    -2 : Port not enabled. Call SioReset first.
  917.                      -4 : Port out of range. Expecting  0 to 3.
  918.                      -1 : If timed out.
  919.                      >0 : Character read.
  920.  
  921.           Example
  922.  
  923.                      RetCode := SioGetc(COM1,1);
  924.                      if RetCode <> -1
  925.                        then  writeln('Character is ', chr(RetCode) );
  926.                        else writeln('Timed out');
  927.  
  928.          See Also    SioUnGetc and SioPutc.
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.         PCL4P Reference Manual                                 Page 16
  961.                                   SioInfo
  962.  
  963.  
  964.          Function    Returns PCL4P library version number.
  965.  
  966.            Syntax    function SioInfo(Cmd : Char) : Integer;
  967.  
  968.           Remarks    The  SioInfo  function  returns  an   integer   code
  969.                      corresponding to the library version number.
  970.  
  971.                      SioInfo takes a single argument, which must be 'V'.
  972.  
  973.  
  974.           Returns    hex byte XY where version is denoted as X.Y
  975.  
  976.           Example    (* return version number *)
  977.                      Version := SioInfo('V');
  978.                      WriteLn('Version ',Version div 16,Version mod 16);
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.         PCL4P Reference Manual                                 Page 17
  1021.                          SioIRQ
  1022.  
  1023.  
  1024.  
  1025.          Function    Assigns an IRQ line to a port.
  1026.  
  1027.            Syntax    function SioIRQ(Port,IRQcode:Integer) : Integer;
  1028.  
  1029.           Remarks    The  SioIRQ  function assigns an IRQ line to  a  port.
  1030.                      SioIRQ ( like SioUART ) must be called before  calling
  1031.                      SioReset  in order to have any effect. Unless you have
  1032.                      a non-standard serial  port  configuration,  you  will
  1033.                      never need to call SioIRQ.
  1034.  
  1035.                      IRQ  4 is the standard primary IRQ line while IRQ 3 is
  1036.                      the standard secondary  IRQ  line.   The  default  IRQ
  1037.                      codes are thus:
  1038.  
  1039.                      Port    IRQ Code
  1040.                      COM1    PRIMARY
  1041.                      COM2    SECONDARY
  1042.                      COM3    PRIMARY
  1043.                      COM4    SECONDARY
  1044.  
  1045.                      The  IBM  PS/2  uses  non-standard  COM3 and COM4 port
  1046.                      configurations as follows:
  1047.  
  1048.                      Port    IRQ Code    UART
  1049.                      COM3    SECONDARY   0x3220
  1050.                      COM4    SECONDARY   0x3228
  1051.  
  1052.           Returns    -2 : Port not enabled. Call SioReset first.
  1053.                      -4 : Port out of range. Expecting  0 to 3.
  1054.                       0 : Otherwise
  1055.  
  1056.           Example    (* setup PS/2 COM3 port *)
  1057.                      rc := SioUART(COM3,0x3220);
  1058.                      rc := SioIRQ(COM3,SECONDARY);
  1059.  
  1060.          See Also    SioUART.
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.         PCL4P Reference Manual                                 Page 18
  1081.                                   SioLine
  1082.  
  1083.  
  1084.  
  1085.          Function    Reads the line status register.
  1086.  
  1087.            Syntax    function SioLine(Port:Integer) : Integer;
  1088.  
  1089.           Remarks    The  SioLine function reads the line status register.
  1090.                      The individual bit masks are as follows:
  1091.  
  1092.                      0x20  = Transmitter Buffer Empty.
  1093.                      0x10  = Break detected.
  1094.                      0x08  = Framming error.
  1095.                      0x04  = Parity error.
  1096.                      0x02  = Overrun error.
  1097.                      0x01  = Data ready.
  1098.  
  1099.                      The above are documented in the file PCL4P.H.
  1100.  
  1101.           Returns    -2 : Port not enabled. Call SioReset first.
  1102.                      -4 : Port out of range. Expecting  0 to 3.
  1103.                      >0 : Line status ( rightmost byte of word ).
  1104.  
  1105.           Example
  1106.  
  1107.                      RetCode := SioLine(Port);
  1108.                      if(RetCode and
  1109.                        (FramingError or ParityError or OverrunError)) <> 0
  1110.                        then begin
  1111.                          if (RetCode and FramingError) <> 0
  1112.                                  then writeln('Framing Error');
  1113.                          if (RetCode and ParityError) <> 0
  1114.                                  then writeln('Parity Error');
  1115.                          if (RetCode and OverrunError) <> 0
  1116.                                  then writeln('Overrun Error')
  1117.                        end
  1118.                      else writeln('No error');
  1119.  
  1120.          See Also    SioModem.
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.         PCL4P Reference Manual                                 Page 19
  1141.                                    SioLoopBack
  1142.  
  1143.  
  1144.  
  1145.          Function    Does a UART loopback test.
  1146.  
  1147.            Syntax    function SioLoopBack(Port:Integer) : Integer;
  1148.  
  1149.           Remarks    SioLoopBack  makes  use of the built in loopback test
  1150.                      capability of the INS8250 UART.  Normally  SioLoopBack
  1151.                      will  never  need  to  be called except if you suspect
  1152.                      that your UART is bad. See the LOOPBACK.C program.
  1153.  
  1154.  
  1155.           Returns      0 : Loopback test is successfull.
  1156.                       -2 : Port not enabled. Call SioReset first.
  1157.                       -4 : Port out of range.  Expecting   0  to 3.
  1158.                      -12 : Loopback test fails.
  1159.  
  1160.  
  1161.           Example
  1162.  
  1163.                      RetCode := SioLoopBack(Port);
  1164.                      if RetCode = 0
  1165.                        then write('Loopback test has succeeded');
  1166.                        else write('Loopback test has failed');
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.         PCL4P Reference Manual                                 Page 20
  1201.                                   SioModem
  1202.  
  1203.  
  1204.  
  1205.          Function    Reads the modem status register.
  1206.  
  1207.            Syntax    function SioModem(Port:Integer; Mask:Char) ; Integer;
  1208.  
  1209.           Remarks    The  SioModem function reads the modem register.  The
  1210.                      bit definitions for the function mask are as follows:
  1211.  
  1212.                      Bit  Name     Function
  1213.                       7   DCD       Data Carrier Detect
  1214.                       6   RI        Ring Indicator
  1215.                       5   DSR       Data Set Ready
  1216.                       4   CTS       Clear To Send
  1217.                       3   DeltaDCD  Delta DCD ( DCD has changed )
  1218.                       2   DeltaRI   Delta RI ( RI has changed )
  1219.                       1   DeltaDSR  Delta DSR ( DSR has changed )
  1220.                       0   DeltaCTS  Delta CTS ( CTS has changed )
  1221.  
  1222.                      Bits 4 through 7 represent the absolute state of their
  1223.                      respective RS-232 inputs.  Bits 0 through 3 repesent a
  1224.                      change in the state of their respective RS-232  inputs
  1225.                      since last read.
  1226.  
  1227.                      The above definitions are also in the PCL4P.H file for
  1228.                      use by your application program.
  1229.  
  1230.           Returns    -2 : Port not enabled. Call SioReset first.
  1231.                      -4 : Port out of range. Expecting  0 to 3.
  1232.                      >0 : Modem status ( rightmost byte of word ).
  1233.  
  1234.           Example
  1235.  
  1236.                      (* any change in DCD ? *)
  1237.                      Status := SioModem(Port,DeltaDCD);
  1238.                      if Status < 0 then
  1239.                        begin
  1240.                          RetCode := SioError(Status);
  1241.                          Halt;
  1242.                        end;
  1243.                      else writeln('DCD status = ', SioModem(Port,DCD) );
  1244.  
  1245.          See Also    SioCTS, SioDCD, SioDSR and SioRI.
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.         PCL4P Reference Manual                                 Page 21
  1261.                                   SioParms
  1262.  
  1263.  
  1264.  
  1265.          Function    Sets parity, stop bits, and word length.
  1266.  
  1267.            Syntax    function SioParms(Port,ParityCode,StopBitsCode,
  1268.                          WordLengthCode:Integer) : Integer;
  1269.  
  1270.  
  1271.           Remarks    The SioParms function sets the parity, stop bits, and
  1272.                      word length.  If the default parity  (  none  ),  stop
  1273.                      bits  (  1  ), or word length ( 8 ) is not acceptable,
  1274.                      then they can be changed by calling SioParms. SioParms
  1275.                      can be called either before or after calling SioReset.
  1276.                      See file PCL4P.H.
  1277.  
  1278.                                     Value   Description    PCL4P.H Name
  1279.                      ParityCode:    *0      no parity      NoParity
  1280.                                      1      odd parity     OddParity
  1281.                                      3      even parity    EvenParity
  1282.  
  1283.                      StopBitsCode:  *0      1 stop bit     OneStopBit
  1284.                                      1      2 stop bits    TwoStopBits
  1285.  
  1286.                      WordLengthCode: 0      5 data bits    WordLength5
  1287.                                      1      6 data bits    WordLength6
  1288.                                      2      7 data bits    WordLength7
  1289.                                     *3      8 data bits    WordLength8
  1290.  
  1291.                      * = Default
  1292.  
  1293.           Returns    -4 : Port out of range. Expecting 0 to 3.
  1294.                      -7 : Bad parity code selected. Expecting  0 to 2.
  1295.                      -8 : Bad stop bits code. Expecting  0 or 1.
  1296.                      -9 : Bad word length code. Expecting  0 to 3.
  1297.  
  1298.           Example
  1299.  
  1300.                      RetCode := SioParms(COM1,NoParity,OneStopBit,WordLength8);
  1301.  
  1302.          See Also    SioReset.
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.         PCL4P Reference Manual                                 Page 22
  1321.                                   SioPutc
  1322.  
  1323.  
  1324.  
  1325.          Function    Transmit a character over a serial line.
  1326.  
  1327.            Syntax    function SioPutc(Port:Integer; Ch:Char) : Integer;
  1328.  
  1329.           Remarks    The SioPutc function transmits one character over the
  1330.                      selected serial line.
  1331.  
  1332.                      If flow control has been  enabled,  then  SioPutc  may
  1333.                      return a -1 (time out) if the number of tics specified
  1334.                      in  the  SioFlow function was exceeded waiting for the
  1335.                      modem to raise CTS. Refer to the User's Manual  for  a
  1336.                      discussion of flow control.
  1337.  
  1338.           Returns    -2 : Port not enabled. Call SioReset first.
  1339.                      -4 : Port out of range. Expecting  0 to 3.
  1340.                      -1 : Timed out waiting for CTS (flow control enabled)
  1341.           Example
  1342.  
  1343.                      crc := 0;
  1344.                      for i = 0 to 127 do
  1345.                        begin
  1346.                          crc := crcupdate( buffer[i], crc);
  1347.                          RetCode := SioPutc(Port, buffer[i]);
  1348.                        end;
  1349.                      RetCode := SioPutc(crc);
  1350.  
  1351.          See Also    SioGetc and SioFlow.
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.         PCL4P Reference Manual                                 Page 23
  1381.                                   SioRead
  1382.  
  1383.  
  1384.  
  1385.          Function    Reads any UART register.
  1386.  
  1387.            Syntax    function SioRead(Port:Integer) : Integer;
  1388.  
  1389.           Remarks    The  SioReset  function directly reads the contents of
  1390.                      any of the 7 UART registers. This function  is  useful
  1391.                      when  debugging  application programs, and as a method
  1392.                      for verifying UART contents. Refer to  the  PCL  Users
  1393.                      Manual for a discussion of the 7 UART registers.
  1394.  
  1395.          Returns      -3 : No buffer available. Call SioRxBuf first.
  1396.                       -4 : Port out of range. Expecting  0 to 3.
  1397.  
  1398.           Example    Reg : Integer;  (* UART register *)
  1399.                      Contents : Integer; (* Contents of UART *)
  1400.                      (* print contents of 7 UART registers *)
  1401.                      for Reg=0 to 7 do
  1402.                         begin
  1403.                           Contents = SioRead(Port,Reg);
  1404.                           WriteLn('COM',1+Port,'   UART Register ',Reg,
  1405.                                   '  = ',Contents);
  1406.                         end;
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.         PCL4P Reference Manual                                 Page 24
  1441.                                   SioReset
  1442.  
  1443.  
  1444.  
  1445.          Function    Initialize a serial port for processing.
  1446.  
  1447.            Syntax    function SioReset(Port,BaudCode:Integer) : Integer;
  1448.  
  1449.           Remarks    The SioReset function initializes the selected serial
  1450.                      port.  SioReset should be called after calling SioParm
  1451.                      and SioRxBuf but before  making  any  other  calls  to
  1452.                      PCL4P.   SioReset uses the parity, stop bits, and word
  1453.                      length value previously set  if  SioParm  was  called,
  1454.                      otherwise the default values ( see SioParm ) are used.
  1455.  
  1456.                      Recall  that  COM1  and  COM3 share the same interrupt
  1457.                      vector and therefore  cannot  operate  simultaneously.
  1458.                      Similiarly,    COM2    and    COM4    cannot   operate
  1459.                      simultaneously. Any other combination of two ports can
  1460.                      be used.
  1461.  
  1462.                      By specifing NORESET ( -1 ) for the  baud  rate  code,
  1463.                      the  port  will  NOT  be reset.  This is used to "take
  1464.                      over" a port from a host communications  program  that
  1465.                      allows  a  "DOS  gateway".   External protocols can be
  1466.                      implemented this way. See SioBaud for a  list  of  the
  1467.                      baud rate codes, or see "PCL4P.H".
  1468.  
  1469.          Returns      -3 : No buffer available. Call SioRxBuf first.
  1470.                       -4 : Port out of range. Expecting  0 to 3.
  1471.                      -11 : Bad baud rate code selected. Expecting  0 to 9.
  1472.                      -13 : UART  undefined.   SioUART(Port,0)  was  called
  1473.                            previously.
  1474.                      -14 : Bad or missing UART.  You may not have hardware
  1475.                            present.
  1476.                      -15 : Port already enabled.  SioReset has already been
  1477.                            called.
  1478.                      -16 : Cannot enable both COM1 & COM3  or  COM2 & COM4.
  1479.  
  1480.           Example
  1481.  
  1482.                      RetCode := SioRxBuf(COM1,Ofs(Buffer),Seg(Buffer),Size128);
  1483.                      RetCode := SioReset(Com1,Baud38400);
  1484.                      if RetCode = 0 then writeln('RESET ok');
  1485.                      else begin
  1486.                        RetCode := SioError(rc);
  1487.                        if (RetCode and OverrunError) <> 0
  1488.                                          then writeln('Overrun Error');
  1489.                        if (RetCode and ParityError) <> 0
  1490.                                          then writeln('Parity Error');
  1491.                        if (RetCode and FramingError) <> 0
  1492.                                          then writeln('Framing Error');
  1493.                        if (RetCode and BreakDetected) <> 0
  1494.                                          then writeln('Break Detected');
  1495.                      end;
  1496.  
  1497.          See Also    SioBaud, SioParms, SioRxBuf, SioDone, and SioUART.
  1498.  
  1499.  
  1500.         PCL4P Reference Manual                                 Page 25
  1501.                                    SioRI
  1502.  
  1503.  
  1504.  
  1505.          Function    Reads the Ring Indicator ( RI ) modem status bit.
  1506.  
  1507.            Syntax    function SioRI(Port:Integer) : Integer;
  1508.  
  1509.           Remarks    The SioRI function is used to read the Ring Indicator
  1510.                      ( RI ) modem status bit. Also see SioModem.
  1511.  
  1512.           Returns    -2 : Port not enabled. Call SioReset first.
  1513.                      -4 : Port out of range.  Expecting   0  to 3.
  1514.                       0 : RI is clear.
  1515.                      >0 : RI is set ( RING has occurred ).
  1516.  
  1517.           Example
  1518.  
  1519.                      RetCode := SioRI(Port);
  1520.                      if RetCode > 0 then write('RING');
  1521.  
  1522.          See Also    SioDSR, SioCTS, SioDCD, and SioModem.
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.         PCL4P Reference Manual                                 Page 26
  1561.                                   SioRTS
  1562.  
  1563.  
  1564.  
  1565.          Function    Sets,  clears,  or  reads the Request to Send ( RTS )
  1566.                      line.
  1567.  
  1568.            Syntax    function SioRTS(Port:Integer; Cmd:Char) : Integer;
  1569.  
  1570.           Remarks    The SioRTS function controls the  Request  to  Send  (
  1571.                      RTS  )  bit  in the modem control register. Commands (
  1572.                      defined in PCL4P.H ) are:
  1573.  
  1574.                      SetPort  ('S')   -- set RTS ( ON )
  1575.                      ClrPort  ('C') -- clear RTS ( OFF )
  1576.                      ReadPort ('R')  -- read RTS
  1577.  
  1578.           Returns    -2 : Port not enabled. Call SioReset first.
  1579.                      -4 : Port out of range. Expecting  0 to 3.
  1580.                      -5 : Command is not one of 'S', 'C', or 'R'.
  1581.                       0 : RTS is OFF (READ Command).
  1582.                      >0 : RTS is ON  (READ Command).
  1583.  
  1584.           Example
  1585.  
  1586.                      (* turn off RTS for modem *)
  1587.                      RetCode := SioRTS(Port,ClrPort);
  1588.  
  1589.          See Also    SioDTR.
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.         PCL4P Reference Manual                                 Page 27
  1621.                                   SioRxBuf
  1622.  
  1623.  
  1624.  
  1625.          Function    Sets up receive buffers.
  1626.  
  1627.            Syntax    function SioRxBuf(Port,BufferOfs,BufferSeg,
  1628.                                          SizeCode:Integer) : Integer;
  1629.  
  1630.           Remarks    The SioRxBuf function passes the address and  size  of
  1631.                      the   receive  buffer  to  PCL4P.  Recall  that  PCL4P
  1632.                      requires  a  receive   buffer   for   each   port   in
  1633.                      simultaneous  operation  since the receive function is
  1634.                      interrupt driven. SioRxBuf passes the  receive  buffer
  1635.                      to  PCL4P  for  both  the  primary  (  COM1/COM3 ) and
  1636.                      secondary ( COM2/COM4 )  ports.   It  must  be  called
  1637.                      before   any  incoming  characters  can  be  received.
  1638.                      SioRxBuf must be called before SioReset.  Buffer  size
  1639.                      codes are listed in "PCL4P.H".
  1640.  
  1641.                      Size Code       Buffer Size    PCL4P.H Name
  1642.                         0              8 bytes        Size8
  1643.                         1             16 bytes        Size16
  1644.                         2             32 bytes        Size32
  1645.                         3             64 bytes        Size64
  1646.                         4            128 bytes        Size128
  1647.                         5            256 bytes        Size256
  1648.                         6            512 bytes        Size512
  1649.                         7           1024 bytes        Size1024 or Size1K
  1650.                         8           2048 bytes        Size2048 or Size2K
  1651.                         9           4096 bytes        Size4096 or Size4K
  1652.                        10           8192 bytes        Size8192 or Size8K
  1653.                        11          16384 bytes        Size16384 or Size16K
  1654.                        12          32768 bytes        Size32768 or Size32K
  1655.  
  1656.           Returns    -4 : Port out of range. Expecting 0 to 3.
  1657.                     -10 : Bad buffer size code. Expecting 0 to 11.
  1658.  
  1659.           Example
  1660.  
  1661.                      RetCode := SioRxBuf( COM1, Ofs(RxBuf),Seg(RxBuf), 128);
  1662.  
  1663.          See Also    SioReset.
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.         PCL4P Reference Manual                                 Page 28
  1681.                                   SioRxFlush
  1682.  
  1683.  
  1684.  
  1685.          Function     To  flush  the  receive  buffer  associated  with the
  1686.                      specified port.
  1687.  
  1688.            Syntax    function SioRxFlush(Port:Integer) : Integer;
  1689.  
  1690.           Remarks    The SioRxFlush function will delete any characters  in
  1691.                      the  receive  buffer  for  the  specified port.  After
  1692.                      execution, the receive buffer  will  be  empty.   Call
  1693.                      SioRxBuf after resetting a port in order to delete any
  1694.                      spurious characters.
  1695.  
  1696.           Returns    -2 : Port not enabled. Call SioReset first.
  1697.                      -4 : Port out of range. Expecting 0 to 3.
  1698.  
  1699.           Example
  1700.  
  1701.                      (* setup receive buffer  and  reset port *)
  1702.                      RetCode := SioRxBuf(COM1,Ofs(Buffer),Seg(Buffer),Size1024);
  1703.                      RetCode := SioReset(COM1,Baud115200);
  1704.                      (* flush any spurious character *)
  1705.                      RetCode := SioRxFlush(COM1);
  1706.                      (* ready for serial processing ! *)
  1707.  
  1708.          See Also    SioRxQue.
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.         PCL4P Reference Manual                                 Page 29
  1741.                                   SioRxQue
  1742.  
  1743.  
  1744.  
  1745.          Function    Returns the number of characters in the receive queue.
  1746.  
  1747.            Syntax    function SioRxQue(Port:Integer) : Integer;
  1748.  
  1749.           Remarks    The  SioRxQue  function  will  return  the  number  of
  1750.                      characters in the receive queue. It  can  be  used  to
  1751.                      implement XON/XOFF flow control.
  1752.  
  1753.           Returns    -2 : Port not enabled. Call SioReset first.
  1754.                      -4 : Port out of range. Expecting  0 to 3.
  1755.  
  1756.           Example
  1757.  
  1758.                      RetCode := SioRxBuf(COM1,Ofs(Buffer),Seg(Buffer),Size128);
  1759.                      (* implement XON / XOFF *)
  1760.                      count := SioRxQue(COM1);
  1761.                      if (last=XON) and (count>120) then
  1762.                        begin
  1763.                          RetCode := SioPutc(COM1,char(XOFF));
  1764.                          last := XOFF;
  1765.                        end
  1766.                     if (last=XOFF) and (count<8) then
  1767.                       begin
  1768.                         RetCode := SioPutc(COM1,char(XON));
  1769.                         last := XON;
  1770.                       end
  1771.  
  1772.         See Also     SioRxFlush.
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.         PCL4P Reference Manual                                 Page 30
  1801.                                   SioTimer
  1802.  
  1803.  
  1804.  
  1805.          Function    Returns  the  number  of  system  clock  tics   since
  1806.                      midnight.
  1807.  
  1808.            Syntax    function SioTimer : LongInt;
  1809.  
  1810.           Remarks    The SioTimer function will return the number of system
  1811.                      clock tics since midnight, at 18.2065 tics per second.
  1812.                      This function is usefull for timing various functions.
  1813.                      Also see SioDelay.
  1814.  
  1815.           Returns    timer tics.
  1816.  
  1817.           Example
  1818.  
  1819.                      Var Time : LongInt;
  1820.                      ...
  1821.                      Time := SioTimer();
  1822.                      (* do some stuff *)
  1823.                      Writeln('Elasped time ', SioTimer - Time );
  1824.  
  1825.          See Also    SioDelay.
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.         PCL4P Reference Manual                                 Page 31
  1861.                                   SioUART
  1862.  
  1863.  
  1864.  
  1865.          Function    Sets the UART base address.
  1866.  
  1867.            Syntax    function SioUART(Port,Address:Integer) : Integer;
  1868.  
  1869.           Remarks    The SioUART function sets the UART  base  address  for
  1870.                      the  specified  port.   SioUART  must be called before
  1871.                      SioReset in order to have effect.  Be  extremely  sure
  1872.                      that you know what you are doing! Note that PCL4P uses
  1873.                      the   standard   PC/XT/AT  port  addresses,  interrupt
  1874.                      request  lines,   and   interrupt   service   vectors.
  1875.                      Therefore,   this   function   is   only   needed  for
  1876.                      non-standard ports.
  1877.  
  1878.           Returns    >0 : The previous base address for this port.
  1879.                      -4 : Port out of range.  Expecting 0 to 3.
  1880.  
  1881.           Example    (* Record fact that you don't have COM4 *)
  1882.                      RetCode := SioUART(COM4, 0);
  1883.  
  1884.          See Also    SioReset, SioIRQ.
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.         PCL4P Reference Manual                                 Page 32
  1921.                                   SioUnGetc
  1922.  
  1923.  
  1924.  
  1925.          Function    "Un-gets" the last character read with SioGetc().
  1926.  
  1927.            Syntax    function SioUnGetc(Port:Integer; Ch:Char) : Integer;
  1928.  
  1929.           Remarks    The  SioUnGetc  function  returns  (  pushes  )   the
  1930.                      character  back  into  the  serial  input buffer.  The
  1931.                      character pushed will be the next  character  returned
  1932.                      by  SioGetc.  Only  one  character can be pushed back.
  1933.                      This function works just like the "ungetc" function in
  1934.                      the C language.
  1935.  
  1936.           Returns    -2 : Port not enabled. Call SioReset first.
  1937.                      -4 : Port out of range. Expecting 0 to 3.
  1938.  
  1939.           Example    (* push back c so next SioGetc will get it *)
  1940.                      RetCode := SioUnGetc(Port,c);
  1941.  
  1942.          See Also    SioReset.
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.         PCL4P Reference Manual                                 Page 33
  1981.                                   Function Sumary
  1982.  
  1983.  
  1984.  
  1985.          ***********************************************************
  1986.          * Function    *   Arg1   *   Arg2   *   Arg3   *   Arg4   *
  1987.          ***********************************************************
  1988.          * SioBaud     * Port     * BaudCode *          *          *
  1989.          * SioBrkKey   *          *          *          *          *
  1990.          * SioBrkSig   * Port     * Cmd      *          *          *
  1991.          * SioCTS      * Port     *          *          *          *
  1992.          * SioDCD      * Port     *          *          *          *
  1993.          * SioDelay    * Tics     *          *          *          *
  1994.          * SioDone     * Port     *          *          *          *
  1995.          * SioDSR      * Port     *          *          *          *
  1996.          * SioDTR      * Port     * Cmd      *          *          *
  1997.          * SioError    * Code     *          *          *          *
  1998.          * SioFIFO     * Port     * FIFOcode *          *          *
  1999.          * SioFlow     * Port     * Tics     *          *          *
  2000.          * SioGetc     * Port     * Tics     *          *          *
  2001.          * SioInfo     * Cmd      *          *          *          *
  2002.          * SioIRQ      * Port     * IRQcode  *          *          *
  2003.          * SioLine     * Port     *          *          *          *
  2004.          * SioLoopBack * Port     *          *          *          *
  2005.          * SioModem    * Port     * Mask     *          *          *
  2006.          * SioParms    * Port     * Parity   * StopBits *WordLength*
  2007.          * SioPutc     * Port     * Ch       *          *          *
  2008.          * SioRead     * Port     * Register *          *          *
  2009.          * SioReset    * Port     * BaudCode *          *          *
  2010.          * SioRI       * Port     *          *          *          *
  2011.          * SioRTS      * Port     * Cmd      *          *          *
  2012.          * SioRxBuf    * Port     * Ofs(Buff)* Seg(Buff)* SizeCode *
  2013.          * SioRxFlush  * Port     *          *          *          *
  2014.          * SioRxQue    * Port     *          *          *          *
  2015.          * SioTimer    *          *          *          *          *
  2016.          * SioUART     * Port     * Address  *          *          *
  2017.          * SioUnGetc   * Port     * Ch       *          *          *
  2018.          ***********************************************************
  2019.  
  2020.          ( 30 functions)
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.         PCL4P Reference Manual                                 Page 34
  2041.                     Error Code Summary
  2042.  
  2043.  
  2044.  
  2045.          *****************************************************************
  2046.          * Code *  Description                                           *
  2047.          *****************************************************************
  2048.          *   0  *  No error.                                             *
  2049.          *  -1  *  Timeout waiting for input. (Only returned by SioGetc).*
  2050.          *  -2  *  Port not enabled. Call SioReset first.                *
  2051.          *  -3  *  No buffer available.  Call SioRxBuf first.            *
  2052.          *  -4  *  Port out of range. Expecting 0 to 3. (COM1 = 0)       *
  2053.          *  -5  *  Expected 'S', 'C', or 'R' as second argument.         *
  2054.          *  -6  *  Expected 'A', 'C', or 'D' as second argument.         *
  2055.          *  -7  *  Bad parity code specified. Must be 0 to 7.            *
  2056.          *  -8  *  Bad stop bits code specified. Must be 0 or 1.         *
  2057.          *  -9  *  Bad wordlength code specified. Must be 0 to 3.        *
  2058.          * -10  *  Bad buffer size code specified. Must be 0 to 11.      *
  2059.          * -11  *  Bad baud rate code. Must be 0 to 9.                   *
  2060.          * -12  *  Loopback test fails.                                  *
  2061.          * -13  *  UART undefined.                                       *
  2062.          * -14  *  Missing or bad UART.                                  *
  2063.          * -15  *  Port already enabled.                                 *
  2064.          * -16  *  Cannot enable both COM1 and COM3 or COM2 and COM4.    *
  2065.          *****************************************************************
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.         PCL4P Reference Manual                                 Page 35
  2101.